package com.example.config;


import com.example.interceptor.ControllerInteceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration // 会导致swagger失效 WebMvcConfigurerAdapter  和 WebMvcConfigurationSupport,WebMvcConfigurer区别
public class InterceptorConfig extends WebMvcConfigurerAdapter {//这个不会导致swagger失效
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new ControllerInteceptor()).addPathPatterns("/login").addPathPatterns("/index");
    }
}
